Estimating Pi, π

Given the desired depth of calculation


This calculator estimates π to the requested precision. It uses one of the following formulas:

James Gregory and Gottfried Leibniz around 1675. This formula is very slow to converge.

π = 4 - 4 3 + 4 5 - 4 7 + 4 9 - 4 11 + ...

John Wallis's formula from 1655. This formula is a little slower than Leibniz's.

π 2 = 2 1 × 2 3 × 4 3 × 4 5 × 6 5 × 6 7 × 8 7 × 8 9 × ...

One of Euler's many formulas. This formula is a little better than Leibniz's.

π 2 6 = 1 + 1 2 2 + 1 3 2 + 1 4 2 + 1 5 2 + 1 6 2 + ...

Finally, a killer formula from Srinivasa Ramanujan around 1910.

1 π = 2 2 3 4 × 11 2 n = 0 4 n ! n ! 4 × 1103 + 26390 n 4 × 99 4 n

To use the calculator simply enter the depth of the calculation (the number of terms utilized). The display shows the result and the difference from π as defined by javascript's Math.PI. Below π is shown calculated to 50 places.

3.141 592 653 589 793 238 462 643 383 279 502 884 197 169 399 375 11




Enter the number of terms to utilize:






I can only show π to 21 numerals of precision as that is the limit of the Number.precision() function. The Ramanujan function shows 0% error at a depth of 2, while only the first 17 decimals are accurate. This shows the limits of 64-bit math.